const createTreeList = (data, level) => {
    if(!data?.length) return
    const treeList = []
    data.forEach(item => {
        if(item.pid === level) {
            treeList.push(item)
            const children = createTreeList(data, item.id)
            children?.length && (item.children = children)
        }
    })
    return treeList
}

export default createTreeList